#define   _CRT_SECURE_NO_WARNINGS  1
#define n 2
#include<stdio.h>
int main()
{
	int arr1[n];
	int arr2[n];
	int arr3[n];
	int arr4[n];
	int i;
	int j;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr1[i]);
	}
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr2[i]);
	}
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr3[i]);
	}
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr4[i]);
	}
	int arr5[n * n];
	int t = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
			arr5[t++] = arr1[i] * arr2[j];
	}
	int arr6[n * n];
	int tam = 0;
	t = 0;
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
			arr6[t++] = arr3[i] * arr4[j];
	}
	for (i = 0; i < n * n; i++)
	{
		for (j = 0; j < n * n; j++)
			if (arr5[i] + arr6[j] == 0)
				tam++;
	}
	printf("%d", tam);
	return 0;
}